package com.eigaland.change_machine.business.admin

import android.os.Bundle
import android.view.View
import androidx.databinding.DataBindingUtil
import com.eigaland.change_machine.R
import com.eigaland.change_machine.business.setting.SettingFragment
import com.eigaland.change_machine.business.transaction_list.TransactionListFragment
import com.eigaland.change_machine.databinding.FragmentAdminBinding
import com.eigland.eigaland_lib.base.BaseLazyFragment

/**
 * The VM class on this page is a bit redundant,
 * because it's just a simple jump, so the logic is written directly in the fragment
 */
public class AdminFragment :BaseLazyFragment<AdminFragmentVM, FragmentAdminBinding>(){
    override fun initVM() {

        binding?.tvTransactionList?.setOnClickListener {
            var fragment = TransactionListFragment()
            fragment.arguments = Bundle().apply {
                this.putBoolean("isSearch",false)
            }
            supportDelegate.start(fragment)
        }

        binding?.tvCutPaper?.setOnClickListener {
            

        }

        binding?.tvSearchHistory?.setOnClickListener {
            var fragment = TransactionListFragment()
            fragment.arguments = Bundle().apply {
                this.putBoolean("isSearch",true)
            }
            supportDelegate.start(fragment)
        }

        binding?.tvCloseShift?.setOnClickListener {

        }

        binding?.tvSetting?.setOnClickListener {
            var fragment = SettingFragment()
            supportDelegate.start(fragment)
        }

    }

    override fun setUpViewData(view: View) {
        binding = DataBindingUtil.bind(view)
        vm = AdminFragmentVM()
        binding?.adminVM = vm
        vm?.initData()


    }

    override fun setLayoutId() = R.layout.fragment_admin
}